﻿#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <string.h>

#include "app/audio/audio.h"

#define GPIO_AUDIO_EN                                68   //音频使能

int main(int argc, char* argv[])
{
    if (argc < 2)
    {
        printf("usage: %s wav-filePath volum\n", argv[0]);
        return -1;
    }


    if (argv[1] == NULL || strlen(argv[1]) <= 0)
    {
        printf("file error.\n");
        return -1;
    }

    int volum = 100;
    if (argc >= 3)
    {


        volum = atoi(argv[2]);
        printf("volum: %d\n", volum);

        if (volum < 0 || volum >= 200)
        {
#ifdef DEBUG
            printf("error volum:%s\n", argv[2]);
            printf("normal:100\n");
            printf("diminution:1-99\n");
            printf("increase:101-200\n");

#endif // DEBUG
            volum = 100;
        }
    }

    init_audio();
    play_wav(argv[1], volum);

    return 0;
}